package com.tb.boxman;

/**
 * Created by 汪贵春 on 2016/7/8.
 */
public class Maps {

    //第1关地图
    public static final int[][] map1 = new int[][]{
            {0, 0, 1, 1, 1, 0, 0, 0},
            {0, 0, 1, 0, 1, 0, 0, 0},
            {0, 0, 1, 0, 1, 1, 1, 1},
            {1, 1, 1, 2, 0, 2, 0, 1},
            {1, 0, 0, 2, 0, 1, 1, 1},
            {1, 1, 1, 1, 2, 1, 0, 0},
            {0, 0, 0, 1, 0, 1, 0, 0},
            {0, 0, 0, 1, 1, 1, 0, 0}
    };
    public static final int[] player1 = new int[]{4,4};
    public static final int[][] target1 = new int[][]{{1, 3}, {4, 1}, {6, 4}, {3, 6}};
    //第2关地图
    public static final int[][] map2 = new int[][]{
            {1,1,1,1,1,0,0,0,0},
            {1,0,0,0,1,0,0,0,0},
            {1,0,2,0,1,0,1,1,1},
            {1,0,2,2,1,0,1,0,1},
            {1,1,1,0,1,1,1,0,1},
            {0,1,1,0,0,0,0,0,1},
            {0,1,0,0,0,1,0,0,1},
            {0,1,0,0,0,1,1,1,1},
            {0,1,1,1,1,1,0,0,0}

    };
    public static final int[] player2 = new int[]{2,3};
    public static final int[][] target2 = new int[][]{{3,7},{4,7},{5,7}};
    //第3关地图
    public static final int[][] map3 = new int[][]{
            {1,1,1,1,1,0},
            {1,1,0,0,1,0},
            {1,0,0,2,1,0},
            {1,1,2,0,1,1},
            {1,1,0,2,0,1},
            {1,0,2,0,0,1},
            {1,0,0,2,0,1},
            {1,1,1,1,1,1}

    };
    public static final int[] player3 = new int[]{2,2};
    public static final int[][] target3 = new int[][]{{5,1},{6,1},{6,2},{6,3},{6,4}};
    //第4关地图
    public static final int[][] map4 = new int[][]{
            {0,1,1,1,1,0,0,0},
            {0,1,0,0,1,1,1,0},
            {0,1,0,2,0,0,1,0},
            {1,1,1,0,1,0,1,1},
            {1,0,1,0,1,0,0,1},
            {1,0,2,0,0,1,0,1},
            {1,0,0,0,0,2,0,1},
            {1,1,1,1,1,1,1,1}

    };
    public static final int[] player4 = new int[]{2,2};
    public static final int[][] target4 = new int[][]{{4,1},{5,1},{6,1}};
    //第5关地图
    public static final int[][] map5 = new int[][]{
            {0,0,1,1,1,1,1,1},
            {0,0,1,0,0,0,0,1},
            {1,1,1,2,2,2,0,1},
            {1,0,0,2,0,0,0,1},
            {1,0,2,0,0,0,1,1},
            {1,1,1,1,0,0,1,0},
            {0,0,0,1,1,1,1,0}

    };
    public static final int[] player5 = new int[]{3,1};
    public static final int[][] target5 = new int[][]{{3,4},{3,5},{4,3},{4,4},{4,5}};
    //第6关地图
    public static final int[][] map6 = new int[][]{
            {0,0,1,1,1,1,1,0},
            {1,1,1,0,0,0,1,0},
            {1,0,2,0,0,0,1,1},
            {1,0,0,0,2,0,0,1},
            {1,1,1,0,2,2,0,1},
            {0,0,1,0,0,0,1,1},
            {0,0,1,1,1,1,1,0}

    };
    public static final int[] player6 = new int[]{2,3};
    public static final int[][] target6 = new int[][]{{2,4},{3,3},{3,5},{4,4}};
    //第7关地图
    public static final int[][] map7 = new int[][]{
            {0,0,1,1,1,1,0,0},
            {0,0,1,0,0,1,0,0},
            {0,1,1,0,0,1,1,0},
            {0,1,0,0,2,0,1,0},
            {1,1,0,2,0,0,1,1},
            {1,0,0,1,2,2,0,1},
            {1,0,0,0,0,0,0,1},
            {1,1,1,1,1,1,1,1}

    };
    public static final int[] player7 = new int[]{6,3};
    public static final int[][] target7 = new int[][]{{1,3},{1,4},{2,4},{3,5}};
    //第8关地图
    public static final int[][] map8 = new int[][]{
            {1,1,1,1,1,1,1,1},
            {1,0,0,1,0,0,0,1},
            {1,0,2,0,0,2,0,1},
            {1,0,2,0,2,0,1,1},
            {1,0,2,0,0,2,0,1},
            {1,0,0,1,0,0,0,1},
            {1,1,1,1,1,1,1,1}

    };
    public static final int[] player8 = new int[]{3,1};
    public static final int[][] target8 = new int[][]{{2,3},{2,4},{3,3},{3,4},{4,3},{4,4}};
    //第9关地图
    public static final int[][] map9 = new int[][]{
            {1,1,1,1,1,1,0,0,0},
            {1,0,0,0,0,1,0,0,0},
            {1,0,2,2,2,1,1,0,0},
            {1,0,0,1,0,0,1,1,1},
            {1,1,0,0,0,0,2,0,1},
            {0,1,0,0,0,0,0,0,1},
            {0,1,1,1,1,1,1,1,1}

    };
    public static final int[] player9 = new int[]{5,3};
    public static final int[][] target9 = new int[][]{{3,4},{3,5},{4,4},{4,5}};
    //第10关地图
    public static final int[][] map10 = new int[][]{
            {1,1,1,1,1,1,1},
            {1,0,0,2,0,0,1},
            {1,0,0,1,0,0,1},
            {1,0,2,2,2,0,1},
            {1,0,0,2,0,0,1},
            {1,0,2,2,2,0,1},
            {1,0,0,1,0,0,1},
            {1,1,1,1,1,1,1}

    };
    public static final int[] player10 = new int[]{6,5};
    public static final int[][] target10 = new int[][]{{1,1},{1,2},{1,4},{1,5},{2,1},{2,2},{2,4},{2,5}};
    //第11关地图
    public static final int[][] map11 = new int[][]{
            {0,1,1,1,1,1,0,0},
            {0,1,0,0,0,1,1,1},
            {1,1,0,1,2,0,0,1},
            {1,0,2,0,0,0,0,1},
            {1,0,0,2,2,0,1,1},
            {1,1,1,0,1,0,1,0},
            {0,0,1,0,0,0,1,0},
            {0,0,1,1,1,1,1,0}

    };
    public static final int[] player11 = new int[]{1,4};
    public static final int[][] target11 = new int[][]{{3,2},{3,3},{3,5},{5,5}};
    //第12关地图
    public static final int[][] map12 = new int[][]{
            {1,1,1,1,1,1},
            {1,0,0,0,0,1},
            {1,0,2,0,0,1},
            {1,1,2,0,0,1},
            {1,0,2,0,1,1},
            {1,0,2,0,1,0},
            {1,0,2,0,1,0},
            {1,0,0,0,1,0},
            {1,1,1,1,1,0}

    };
    public static final int[] player12 = new int[]{3,3};
    public static final int[][] target12 = new int[][]{{3,2},{4,2},{5,2},{6,2},{7,2}};
    //第13关地图
    public static final int[][] map13 = new int[][]{
            {0,0,1,1,1,1,0},
            {0,0,1,0,0,1,0},
            {1,1,1,2,0,1,1},
            {1,0,0,2,0,0,1},
            {1,0,0,2,0,0,1},
            {1,0,0,2,0,1,1},
            {1,1,1,2,0,1,0},
            {0,0,1,0,1,1,0},
            {0,0,1,1,1,0,0}

    };
    public static final int[] player13 = new int[]{3,5};
    public static final int[][] target13 = new int[][]{{3,3},{4,3} ,{5,3},{6,3},{7,3}};
    //第14关地图
    public static final int[][] map14 = new int[][]{
            {1,1,1,1,1,0,0,0,0},
            {1,0,0,0,1,1,1,1,1},
            {1,0,1,0,1,0,0,0,1},
            {1,0,2,0,0,0,2,0,1},
            {1,0,0,1,2,1,2,1,1},
            {1,0,0,2,0,0,0,1,0},
            {1,0,0,0,0,1,1,1,0},
            {1,1,1,1,1,1,0,0,0}

    };
    public static final int[] player14 = new int[]{5,2};
    public static final int[][] target14 = new int[][]{{4,1},{4,2},{5,1},{6,1},{6,2}};
    //第15关地图
    public static final int[][] map15 = new int[][]{
            {0,1,1,1,1,1,1,0},
            {0,1,0,0,0,0,1,1},
            {1,1,0,1,1,2,0,1},
            {1,0,0,0,2,0,0,1},
            {1,0,0,1,2,0,0,1},
            {1,0,0,0,0,1,1,1},
            {1,1,1,1,1,1,0,0}

    };
    public static final int[] player15 = new int[]{5,3};
    public static final int[][] target15 = new int[][]{{2,2},{3,2},{3,3}};

    //最后关地图
    public static final int[][] mapLast = new int[][]{
            {1,1,1,1,1,1,1,1},
            {1,0,0,0,0,0,0,1},
            {1,1,1,1,1,1,1,1}
    };
    public static final int[] playerLast = new int[]{1,1};
    public static final int[][] targetLast = new int[][]{{1,6}};

    //地图数组
    private Map[] allMap;

    public Maps(){
        //初始化地图数组
        allMap = new Map[]{
                new Map(map1,player1,target1),
                new Map(map2,player2,target2),
                new Map(map3,player3,target3),
                new Map(map4,player4,target4),
                new Map(map5,player5,target5),
                new Map(map6,player6,target6),
                new Map(map7,player7,target7),
                new Map(map8,player8,target8),
                new Map(map9,player9,target9),
                new Map(map10,player10,target10),
                new Map(map11,player11,target11),
                new Map(map12,player12,target12),
                new Map(map13,player13,target13),
                new Map(map14,player14,target14),
                new Map(map15,player15,target15),



                new Map(mapLast,playerLast,targetLast)
        };

    }
    //获取地图数组
    public int[][] getMap(int i){
        int a[][] = allMap[i].map;

        int b[][] = new int[a.length][a[0].length];
        for (int j = 0; j < b.length; j++) {
            System.arraycopy(a[j], 0, b[j], 0, a[j].length);
            b[j] = a[j].clone();
        }

        return b;
    }
    public int[][] getTarget(int i){
        int a[][] = allMap[i].target;

        int b[][] = new int[a.length][a[0].length];
        for (int j = 0; j < b.length; j++) {
            System.arraycopy(a[j], 0, b[j], 0, a[j].length);
            b[j] = a[j].clone();
        }

        return b;
    }
    public int[] getPlayer(int i){
        return allMap[i].player.clone();
    }

    public int getSumOfMaps(){
        return allMap.length;
    }



    //地图类
    public class Map{
        private int[][] map;            //空地，墙，箱子
        private int[] player;           //玩家位置
        private int[][] target;         //目标点

        public Map(int[][] map,int[] player,int[][] target){
            this.map = map;
            this.player = player;
            this.target = target;
        }
    }


}

